# 计算kitti点云的数量
import os
import struct

file_name = os.getcwd() + r"\..\data\robocar_2015-11-06-11-21-12_lms_front.bin"
f = open(file_name, "rb")

float_file = open(file_name + ".float", 'ab')

while True:
    x_str = f.read(8)
    if x_str == b'':
        break
    y_str = f.read(8)
    z_str = f.read(8)
    x = struct.unpack('d', x_str)[0]
    y = struct.unpack('d', y_str)[0]
    z = struct.unpack('d', z_str)[0]
    float_file.write(struct.pack('f', x))
    float_file.write(struct.pack('f', y))
    float_file.write(struct.pack('f', z))

f.close()
float_file.close()
